#ifndef LOCALTCPSERVER_H
#define LOCALTCPSERVER_H

#include <hv/TcpServer.h>

class LocalTcpServer
{
public:
    LocalTcpServer();
    ~LocalTcpServer();

    bool init(const int port, const std::string host = "127.0.0.1", const int threadNum = 1);
    bool start();
    void stop();

    void registeCb(std::function<void(const char *, int)> cb);
    void activeSend(char *data, size_t sz);
private:
    hv::TcpServer* myServer;

    std::string m_host;
    int m_port;
    int m_threadNum;

    std::function<void(const char *, int)> callBack;
};

#endif // LOCALTCPSERVER_H
